<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:a4j="http://richfaces.org/a4j">

<h:body>

	<h:form>
		<p:panel header="Registration Form">
			<h:panelGrid columns="3" id="regGrid">
			
			<a4j:outputPanel>Name: #{userBean.name}</a4j:outputPanel>
					<p:inputText id="firstName" value="#{registerBean.user.name}" />
						<p:message for="firstName" />
						
			<a4j:outputPanel>Surname: #{userBean.surname}</a4j:outputPanel> 
					<p:inputText id="lastName" value="#{registerBean.user.surname}" />
						<p:message for="lastName" />
						
			<a4j:outputPanel>Birthdate: #{userBean.birthdate}</a4j:outputPanel> 
				<p:inputMask id="dataNascita"  value="#{registerBean.user.birthdate}" mask="99/99/9999">
                                                        <f:convertDateTime pattern="dd/MM/yyyy" />
                                                        <f:validator validatorId="validateDataNascita" />
                                                </p:inputMask>
                                                <p:message for="dataNascita" />
			<h:outputLabel for="password">Password:</h:outputLabel>
				<p:password id="password" value="#{registerBean.user.password}"
					feedback="true" match="pwd2" label="Password"/>
				<p:message for="password" />

				<h:outputLabel for="pwd2">Confirm Password:</h:outputLabel>
				<p:password id="pwd2" label="Confirm Password" value="#{registerBean.user.password}"/>		
			</h:panelGrid>
			<p:commandButton value="Update" update="regGrid"
				action="#{registerBean.update()}" />
		</p:panel>
	</h:form>		
			
<h:link outcome="/user/index" value="Home" /> <br />

</h:body>
</html>